package com.sanpu.kxe.business.main.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sanpu.kxe.R;
import com.sanpu.kxe.business.main.bean.PushDetailsOutput;
import com.sanpu.kxe.common.interfaces.UrlConstants;
import com.sanpu.kxe.jump.imageloader.JKImageLoader;

import java.util.ArrayList;

/**
 * Description：地推物料列表
 * Created by 薛勇军 on 2018/8/23.
 */

public class PushListAdapter extends BaseQuickAdapter<PushDetailsOutput, BaseViewHolder> {

    public PushListAdapter() {
        super(R.layout.item_push_details, new ArrayList<PushDetailsOutput>());
    }

    @Override
    protected void convert(BaseViewHolder helper, PushDetailsOutput item) {
        if (item != null) {
            helper.setGone(R.id.tv_content, false)
                    .setText(R.id.tv_title, !TextUtils.isEmpty(item.getTitle())?item.getTitle():"");
            ImageView imgPoster = helper.getView(R.id.img_poster);
            if (!TextUtils.isEmpty(item.getThumbPath())) {
               JKImageLoader.getInstance().displayImage(mContext,
                       UrlConstants.getBaseUrl()+item.getThumbPath(), imgPoster);
            }
        }
    }
}
